/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.be;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author oscar
 */
@Entity
@Table(name = "col_guiaremision")
//@NamedQueries({@NamedQuery(name = "GuiaRemision.findAll", query = "SELECT g FROM GuiaRemision g"), @NamedQuery(name = "GuiaRemision.findByGreCodigo", query = "SELECT g FROM GuiaRemision g WHERE g.greCodigo = :greCodigo"), @NamedQuery(name = "GuiaRemision.findByGreTipo", query = "SELECT g FROM GuiaRemision g WHERE g.greTipo = :greTipo"), @NamedQuery(name = "GuiaRemision.findByGrefechaRegistro", query = "SELECT g FROM GuiaRemision g WHERE g.grefechaRegistro = :grefechaRegistro"), @NamedQuery(name = "GuiaRemision.findByGreNumero", query = "SELECT g FROM GuiaRemision g WHERE g.greNumero = :greNumero"), @NamedQuery(name = "GuiaRemision.findByGreCantidad", query = "SELECT g FROM GuiaRemision g WHERE g.greCantidad = :greCantidad")})
public class GuiaRemision implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "gre_codigo")
    private Integer greCodigo;
    @Basic(optional = false)
    @Column(name = "gre_tipo")
    private int greTipo;
    @Basic(optional = false)
    @Column(name = "gre_fechaRegistro")
    @Temporal(TemporalType.DATE)
    private Date grefechaRegistro;
    @Basic(optional = false)
    @Column(name = "gre_numero")
    private long greNumero;
    @Basic(optional = false)
    @Column(name = "gre_cantidad")
    private int greCantidad;
    @OneToMany(mappedBy = "greCodigo", fetch = FetchType.LAZY)
    private List<DetalleGuia> detalleGuiaList;

    public GuiaRemision() {
    }

    public GuiaRemision(Integer greCodigo) {
        this.greCodigo = greCodigo;
    }

    public GuiaRemision(Integer greCodigo, int greTipo, Date grefechaRegistro, long greNumero, int greCantidad) {
        this.greCodigo = greCodigo;
        this.greTipo = greTipo;
        this.grefechaRegistro = grefechaRegistro;
        this.greNumero = greNumero;
        this.greCantidad = greCantidad;
    }

    public Integer getGreCodigo() {
        return greCodigo;
    }

    public void setGreCodigo(Integer greCodigo) {
        this.greCodigo = greCodigo;
    }

    public int getGreTipo() {
        return greTipo;
    }

    public void setGreTipo(int greTipo) {
        this.greTipo = greTipo;
    }

    public Date getGrefechaRegistro() {
        return grefechaRegistro;
    }

    public void setGrefechaRegistro(Date grefechaRegistro) {
        this.grefechaRegistro = grefechaRegistro;
    }

    public long getGreNumero() {
        return greNumero;
    }

    public void setGreNumero(long greNumero) {
        this.greNumero = greNumero;
    }

    public int getGreCantidad() {
        return greCantidad;
    }

    public void setGreCantidad(int greCantidad) {
        this.greCantidad = greCantidad;
    }

    public List<DetalleGuia> getDetalleGuiaList() {
        return detalleGuiaList;
    }

    public void setDetalleGuiaList(List<DetalleGuia> detalleGuiaList) {
        this.detalleGuiaList = detalleGuiaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (greCodigo != null ? greCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GuiaRemision)) {
            return false;
        }
        GuiaRemision other = (GuiaRemision) object;
        if ((this.greCodigo == null && other.greCodigo != null) || (this.greCodigo != null && !this.greCodigo.equals(other.greCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.colegiatura.be.GuiaRemision[greCodigo=" + greCodigo + "]";
    }

}
